From be06e2c74bf49e2dd9d01d4d970e6a4082905820 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 28 Nov 2005 16:24:14 +0100 Subject: [PATCH] In alloc_vcpu_struct, after doing a memset on the new allocated vcpu, we do a memcpy from idle0_vcpu.arch to arch of the new vcpu, which causes monitor_pagetable is set to a none 0 value. For VMX guest which is using external shadow mode, this is not what we really need. the previous patch is OK for UP VMX guest, but failed on SMP VMX guest. Signed-off-by: Xin Li --- xen/arch/x86/domain.c | 3 --- xen/arch/x86/vmx.c | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 7319eba244..54d166485c 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -414,9 +414,6 @@ int arch_set_info_guest( d->arch.phys_table = v->arch.guest_table; v->arch.guest_table = mk_pagetable(0); - /* Initialize monitor page table */ - v->arch.monitor_table = mk_pagetable(0); - vmx_final_setup_guest(v); } diff --git a/xen/arch/x86/vmx.c b/xen/arch/x86/vmx.c index a61eb42fb1..7ae4f612b6 100644 --- a/xen/arch/x86/vmx.c +++ b/xen/arch/x86/vmx.c @@ -61,23 +61,30 @@ void vmx_final_setup_guest(struct vcpu *v) { v->arch.schedule_tail = arch_vmx_do_launch; - if ( v == v->domain->vcpu[0] ) + if ( v->vcpu_id == 0 ) { - v->domain->arch.vmx_platform.lapic_enable = - v->arch.guest_context.user_regs.ecx; + struct domain *d = v->domain; + struct vcpu *vc; + + d->arch.vmx_platform.lapic_enable = v->arch.guest_context.user_regs.ecx; v->arch.guest_context.user_regs.ecx = 0; VMX_DBG_LOG(DBG_LEVEL_VLAPIC, "lapic enable is %d.\n", - v->domain->arch.vmx_platform.lapic_enable); + d->arch.vmx_platform.lapic_enable); + + /* Initialize monitor page table */ + for_each_vcpu(d, vc) + vc->arch.monitor_table = mk_pagetable(0); + /* * Required to do this once per domain * XXX todo: add a seperate function to do these. */ - memset(&v->domain->shared_info->evtchn_mask[0], 0xff, - sizeof(v->domain->shared_info->evtchn_mask)); + memset(&d->shared_info->evtchn_mask[0], 0xff, + sizeof(d->shared_info->evtchn_mask)); /* Put the domain in shadow mode even though we're going to be using * the shared 1:1 page table initially. It shouldn't hurt */ - shadow_mode_enable(v->domain, + shadow_mode_enable(d, SHM_enable|SHM_refcounts| SHM_translate|SHM_external|SHM_wr_pt_pte); } -- 2.30.2